package sqlc

import (
	"time"

	"github.com/jackc/pgx/v5/pgtype"
)

func TimeRFC3339ToPGTimez(t string) (pgtype.Timestamptz, error) {
	tt, err := time.Parse(time.RFC3339, t)
	if err != nil {
		return pgtype.Timestamptz{}, err
	}
	return Timez2PGTimez(tt), nil
}

func Timez2PGTimez(t time.Time) pgtype.Timestamptz {
	tz := pgtype.Timestamptz{}
	_ = tz.Scan(t)
	return tz
}
